import Vue from 'vue'
import App from './App.vue'
import router from './router'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import axios from 'axios'
// import {Message} from 'element-ui'

Vue.use(ElementUI)
Vue.prototype.axios

Vue.config.productionTip = false

// //请求地址
// let baseUrl = '/api'
// Vue.prototype.$baseUrl = 'http://10.161.89.54:1000'
// axios.defaults.baseURL = baseUrl


Vue.prototype.$http = (url, method, data, async, fun) => {
    axios({
        url: url,
        method: method,
        data: JSON.stringify(data),
        async: async
    }).then(resp => {

        fun(resp.data)
    }).catch(err => {
        console.log(err)
    })
}

Vue.prototype.$http_formdata = (url, method, data, async, fun) => {
    axios({
        url: url,
        method: method,
        data: data,
        async: async
    }).then(resp => {
        fun(resp.data)
    }).catch(err => {
        console.log(err)
    })
}

new Vue({
    router,
    render: h => h(App)
}).$mount('#app')